package com.iemp.service.impl.page;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iemp.bean.example.AccountExample;
import com.iemp.bean.example.FileExample;
import com.iemp.bean.impl.Account;
import com.iemp.bean.impl.File;
import com.iemp.dao.FileMapper;
import com.iemp.service.base.AbstractPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FileServiceImpl extends AbstractPageService<File> {

    private final FileMapper mapper;

    public FileServiceImpl(FileMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public Integer deleteById(Integer id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public File selectById(Integer id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public int insertSelective(File entity) {
        return mapper.insertSelective(entity);
    }

    @Override
    public int updateByIdSelective(File entity) {
        return mapper.updateByPrimaryKeySelective(entity);
    }

    @Override
    public PageInfo findAllByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return new PageInfo<>(mapper.selectByExample(new FileExample()));
    }
}
